package cn.jly.boot.mp.controller;

import cn.jly.boot.mp.bean.UserInfo;
import cn.jly.boot.mp.service.UserService;
import cn.jly.boot.mp.utils.QueryCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PackageName cn.jly.boot.mp.controller
 * @ClassName CacheController
 * @Description 测试spring cache
 * @Author 姬岚洋
 * @Date 2021/1/5 下午 3:37
 */
@RestController
public class CacheController {
    @Autowired
    private UserService userService;

    @GetMapping("/userInfos")
    public Page<UserInfo> findByCondition(@RequestBody QueryCondition<UserInfo> queryCondition) {
        return userService.findByCondition(queryCondition.getQueryEntity(), PageRequest.of(queryCondition.getPage(), queryCondition.getSize()));
    }
}
